package com.zhuss.order.processor;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import com.zhuss.bean.bo.order.order.DeleteOrderItemBo;
import com.zhuss.common.AbstractProcessor;
import com.zhuss.common.Processor;
import com.zhuss.exception.DzcxException;
import com.zhuss.order.db.dao.ext.OrderItemDao;
import com.zhuss.order.db.entity.OrderItem;

/**
 * @description: 订单明细删除
 * @author: zhushanshuo
 * @create: Tue Jan 12 13:51:36 CST 2021
 **/
@Component("orderItemDelete")
public class OrderItemDelete extends AbstractProcessor<Object, DeleteOrderItemBo> implements Processor<Object, DeleteOrderItemBo> {

    @Autowired
    private OrderItemDao orderItemDao;
    
    @Autowired
	@Qualifier("orderItemRead")
	private OrderItemRead orderItemRead;
    
    
    /**
     * 校验
     */
	@Override
    public void check(DeleteOrderItemBo bo) throws DzcxException {
		// TODO 删除 订单明细 校验， 请补充
    }
    
    /**
     * 操作方法
     */
    @Override
    public Object process(DeleteOrderItemBo param) throws DzcxException {
    	Long orderItemId = param.getOrderItemId();
    	
    	OrderItem record = new OrderItem();
    	record.setOrderItemId(orderItemId);
    	record.setDeleted(param.getDeleted());
    	
    	record.setModifierId(param.getConcurrentUserId());
    	record.setModifier(param.getConcurrentUserName());
    	record.setModifyTime(new Date());
    	orderItemDao.delete(record);
        return null;
    }
    
    /**
     * 操作日志
     */
	@Override
	public Object log(DeleteOrderItemBo param) throws DzcxException {
    	return null;
	}
}
